package com.dabaozhan.modules.wx_app.service.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.InventoryMapper;
import com.dabaozhan.modules.wx_app.entity.InventoryEntity;
import com.dabaozhan.modules.wx_app.entity.QueryListBaseEntity;
import com.dabaozhan.modules.wx_app.service.InventoryService;

@Service("inventoryService")
public class InventoryServiceImpl implements InventoryService{
	
	@Autowired
	private InventoryMapper inventoryMapper;

	@Override
	public List<InventoryEntity> getInventoryList(QueryListBaseEntity entity) {
		return inventoryMapper.getInventoryList(entity);
	}
	
	@Override
	public List<InventoryEntity> getAllList(String userId) {
		return inventoryMapper.getAllList(userId);
	}

	@Override
	public int addInventory(InventoryEntity entity) {
		if(StringUtils.isBlank(entity.getId())){
			entity.setId(Utils.id().toString());
		}
		return inventoryMapper.addInventory(entity);
	}

	@Override
	public int deleteInventory(InventoryEntity entity) {
		return inventoryMapper.deleteInventory(entity);
	}

	@Override
	public long getInventoryCount(QueryListBaseEntity entity) {
		return inventoryMapper.getInventoryCount(entity);
	}

}
